home *** CD-ROM | disk | FTP | other *** search
- /* ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- Object List
-
- Defines an object that holds a list of other objects and uses the
- List Manager to display them.
-
- * List is one-dimensional
- * Objects in list must decendants of ItemObj object
- * ListObj is 1 base, ie first item is item 1
- |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| */
-
- #define CLASS_OBJLIST
-
- #ifndef CLASS_CITEMOBJ
- #include "CItemObj.h"
- #endif
-
- #ifndef CLASS_COBJECT
- #include "CObject.h"
- #endif
-
- #ifndef NULL
- #define NULL 0L
- #endif
-
- #define MYPROCID 42
-
- /* :::::::::: LDEF dispatch routine definition :::::::::: */
- pascal void ListFunction ( int lMessage, Boolean lSelect, Rect *lRect, Cell lCell,
- int lDataOffSet, int lDataLen, ListHandle lHandle );
-
- /* :::::::::: list object :::::::::: */
- struct CListObj:CObject {
- /*** fields */
- ListHandle theList; /* ROM List Manager list */
- Rect viewRect; /* location of the view in the window (incl scroll bar) */
- Boolean drawIt; /* drawing on or not */
-
- /*** methods */
- void IList ( Rect *viewR, /* view rectangle in theWin coords */
- int cellHeight, /* height of a row in pixels */
- Boolean hasScrollBar, /* true if vertical scroll bar */
- int selectMethod, /* List Manager selection flags (zero is best) */
- WindowPtr theWin ); /* window this list displays in */
- void Dispose ( void ); /* throw away everything (but not objects in list) */
-
- Boolean MouseInList ( Point thePoint, /* location of mouse click */
- int modifiers ); /* modifier keys */
- void UpdateList (RgnHandle updateRgn );/* update list (pass visRgn handle) */
- void ActivateList ( Boolean activate ); /* activate event for list, true or false */
- void DrawingOn ( Boolean drawing ); /* turns drawing of new objects on and off */
- void Scroll ( int amount ); /* scroll by amoumt (+ is up) */
-
- int NumObjs ( void ); /* return number of objects in list */
- void Add ( CItemObj *theObject ); /* add a new object to the list */
- void Remove ( CItemObj *theObject ); /* remove the object from the list */
- void ForEach ( VoidFunc doThis ); /* execute the function, passing each object in the list */
- void ForEachSelected ( VoidFunc doThis ); /* same as ForEach, but only selected */
- void SelectNone ( void ); /* de-select all */
- Boolean AnySelected ( void ); /* return true if any objects are selected */
- CItemObj *FirstThat ( BooleanFunc test ); /* return first object in list that satisfies test */
- CItemObj *GetIndObject ( int n ); /* return nth object, if it exists */
- };
-